package com.bestv.engine.filter;

import com.bestv.engine.model.RecommendationItem;

/**
 * Created by Henry on 14-11-28.
 * - 不允许推荐相同名字的节目, 包括名字中存在"HD-"差异的节目, 即同一个节目的高标清版本;
 * - 允许高清推荐标清节目;
 * - 不允许标清推荐高清节目.
 */
public class NameFilter implements Filter {
    private String name;
    private Boolean isHD;

    public NameFilter(String name) {
        this.name = name.replaceFirst("^HD-", "");
        this.isHD = name.startsWith("HD-");
    }

    @Override
    public boolean accept(RecommendationItem item) {
        return !name.equals(item.getName().replaceFirst("^HD-", ""));
//                && (isHD || !item.getName().startsWith("HD-"));
    }
}
